var pagerollnum = 0;
var task_onlyid = 0;
var task_map = new Map();
var sourcekey = true;
var jiebakey = false;
var prepage = "li_0";
var kmean_index = 0;
var kmean_arr = [];
var isHide = false;
kmean_arr[0] = new Array();
kmean_arr[1] = new Array();
var staticnum = [2, 3, 4, 5, 6, 7, 8, 9];
var task_id = [];
var username = 0;
var superman = "";
$(document).ready(function () {

  username = getCookie("username");
  if (username == null) {
    backlogin("没有对应cookie");
  }
  //alert(username);
  var url = "/pipi/search/usertask/" + username;
  $.ajax({
    type: "get",
    url: url,
    success: function (dataList) {
      if (dataList.length == 0) {
        task_onlyid = -1;
        return;
      }
      task_onlyid = dataList[0].task_id;
      chooseonlyid = task_onlyid;
    },
    error: function () {
      // alert('Error');
    }
  })
  closetable();

}
);
function showSubwindow() {
  var status = document.getElementById("subwindow");

  if (status.style.display == "none")
    document.getElementById("subwindow").style.display = "block";//显示

  else if (status.style.display == "block") {

    $("#subwindow").removeClass("subwin_show");
    $("#subwindow").addClass("subwin_close");
    setTimeout("close('#subwindow')", 750);
    setTimeout("close_win()", 850);




  }

}
//点击button没反应 原因函数重名

function uploadfile() {

  html = "<p>" + "正在处理" + "</p>";
  window_append(html);
  var formData = new FormData();
  var data = document.getElementById("uploadfile").files[0];
  var defalutuser = username;
  formData.append('user_id', defalutuser);
  formData.append('uploadfile', data);
  formData.append('taskname', document.getElementById("taskname").value);
  if (data == "" || formData.get('taskname') == "") {
    html = "<p>" + "输入数据有误。" + "</p>";
    window_append(html);
    return;
  }

  $.ajax({
    url: "/pop/upload",
    type: "post",
    data: formData,
    processData: false,
    contentType: false,
    success: function (res) {
      if (res) {
        html = "<p>" + "上传成功！" + "</p>";
        window_append(html);
        // alert("上传成功！"); 
        window.location.reload();
      }
    }

  })

}
//html页面调用js文件里的函数，写法必须为do = function (){}形式，其他方式写，html页面会搜索不到该函数。
deltask = function (id) {
  //alert(id);
  var formData = new FormData();
  formData.append("task_id", id);
  $.ajax({
    url: "/pipi/del",
    type: "post",
    data: formData,
    processData: false,
    contentType: false,
    success: function (res) {
      if (res) {
        html = "<p>" + "删除成功" + "</p>";
        window_append(html);
        window.location.reload();
      }
    },
    error: function (err) {
      html = "<p>" + "网络连接失败,稍后重试" + "</p>";
      window_append(html);
    }
  })
}
function show_win(win_name) {
  if (!$("#" + win_name).is(":hidden")) {
    return;
  }

  if (!$("#mytask").is(":hidden")) {
    $("#tips").addClass("tips_close");
    $("#extra").addClass("extra_close");
    setTimeout("objremove('#tips','tips_close')", 850);
    setTimeout("objremove('#extra','extra_close')", 850);
  } else if (!$("#jieba").is(":hidden")) {
    $("#jieba_ani").addClass("jieba_close");
    console.log($("#jieba_choosebox").hasClass("jieba_close"));
    setTimeout("objremove('#jieba_ani','jieba_close')", 850);

    $("#sourcedata_content").addClass("sourcedata_content_close");
    setTimeout("objremove('#sourcedata_content','sourcedata_content_close')", 850);

    $("#contentbutton").addClass("contentbutton_close");
    setTimeout("objremove('#contentbutton','contentbutton_close')", 850);
  }
  else if (!$("#emotion").is(":hidden")) {
    $("#emotion_content").addClass("emotion_content_close");
    setTimeout("objremove('#emotion_content','emotion_content_close')", 850);
  }
  else if (!$("#wordcloud").is(":hidden")) {
    $("#wordcloud_content").addClass("wordcloud_content_close");
    setTimeout("objremove('#wordcloud_content','wordcloud_content_close')", 850);
  }
  else if (!$("#kmeans").is(":hidden")) {

    $("#kmeans_content_check_box").addClass("kmeans_content_check_box_close");
    setTimeout("objremove('#kmeans_content_check_box','kmeans_content_check_box_close')", 850);
    $("#model_0").addClass("model_0_close");
    setTimeout("objremove('#model_0','model_0_close')", 850);
  }
  setTimeout(
    () => {
      document.getElementById("mytask").style.display = "none";
      document.getElementById("jieba").style.display = "none";
      document.getElementById("emotion").style.display = "none";
      document.getElementById("wordcloud").style.display = "none";
      document.getElementById("kmeans").style.display = "none";
      document.getElementById(win_name).style.display = "block";

      if (document.getElementById("jieba").style.display == "block") {
        prepage = "li_0";
        document.getElementById("sourcedata").className = "ipi-button";
        dojieba();
        showroll(task_onlyid);
        pagegoto(task_onlyid, 1);

      }
      if (document.getElementById("emotion").style.display == "block") {
        doplot(task_onlyid);
        doplotpage();
      }
      if (document.getElementById("wordcloud").style.display == "block") {
        cloud();
        docloud(task_onlyid);
      }
      if (document.getElementById("kmeans").style.display == "block") {
        dokmeans();
      }
    },
    750
  );



}
function listop(buttonid) {

  if (buttonid == "jiebares" && jiebakey == false) {
    document.getElementById("jiebares").className = "opo-button";
    document.getElementById("sourcedata").className = "pip-button";
    jiebakey = true;
    sourcekey = false;
    prepage = "li_0";
    showroll(chooseonlyid + "_jieba");
    pagegoto(chooseonlyid + "_jieba", 1);
  }
  else if (buttonid == "sourcedata" && sourcekey == false) {
    document.getElementById("jiebares").className = "pop-button";
    document.getElementById("sourcedata").className = "ipi-button";
    prepage = "li_0";
    jiebakey = false;
    sourcekey = true;
    showroll(chooseonlyid);
    pagegoto(chooseonlyid, 1);

  }
}

function dojieba() {
  $('#jieba_head').html('');

  var url = "/pipi/search/usertask/" + username;
  $.ajax({
    type: "get",
    url: url,
    success: function (dataList) {
      var html_button = '<ul>';
      for (var i = 0; i < dataList.length; i++) {
        if (i == 0) {
          html_button += '<li class="listbutton" style="color: rgb(36, 191, 64);"onclick="changecolor_jieba(this);choose_task(' + dataList[i].task_id + ')";>' + dataList[i].task_name + '</li>';
        }
        else
          html_button += '<li class="listbutton" onclick="changecolor_jieba(this);choose_task(' + dataList[i].task_id + ')";>' + dataList[i].task_name + '</li>';
      }
      html_button += '</ul>';
      $('#jieba_head').append(html_button);

    },
    error: function () {
      html = "<p>" + "网络连接失败,稍后重试" + "</p>";
      window_append(html);
    }
  })

}
function dokmeans() {
  $('#kmeans_head').html('');

  var url = "/pipi/search/usertask/" + username;
  $.ajax({
    type: "get",
    url: url,
    success: function (dataList) {
      var html_button = '<ul>';
      for (var i = 0; i < dataList.length; i++) {
        task_id[i] = dataList[i].task_id;
        if (i == 0) {
          html_button += '<li class="listbutton" style="color: rgb(36, 191, 64);"onclick="changecolor_kmeans(this);change_task(' + dataList[i].task_id + ')";>' + dataList[i].task_name + '</li>';
        }
        else
          html_button += '<li class="listbutton" onclick="changecolor_kmeans(this);change_task(' + dataList[i].task_id + ')";>' + dataList[i].task_name + '</li>';

      }
      html_button += '</ul>';
      $('#kmeans_head').append(html_button);

      kind = 3;

      var name1 = username + "_" + kind + "_" + dataList[0].task_id + "_" + "0";
      var name2 = username + "_" + kind + "_" + dataList[0].task_id + "_" + "1";
      if (getCookie(name1) != null && getCookie(name2) != null) {
        kmean_arr[0] = getCookie(name1).split(",");
        kmean_arr[1] = getCookie(name2).split(",");
        kmean_index = 0;
        // alert(arr);
        var myChart = echarts.init(document.getElementById('k_char0'));
        var option = {
          //backgroundColor: '#FFF0F5',
          title: {
            text: '轮廓系数得分',
            x: 'center',
            textStyle: {
              fontSize: 25,
              color: '#000000'  //标题颜色
            }
          },
          legend: {
            // orient 设置布局方式，默认水平布局，可选值：'horizontal'（水平） ¦ 'vertical'（垂直）
            orient: 'horizontal',
            // x 设置水平安放位置，默认全图居中，可选值：'center' ¦ 'left' ¦ 'right' ¦ {number}（x坐标，单位px）
            x: 'left',
            // y 设置垂直安放位置，默认全图顶端，可选值：'top' ¦ 'bottom' ¦ 'center' ¦ {number}（y坐标，单位px）
            y: 'top',
            data: ['轮廓系数']
          },

          // 提示框
          tooltip: {
            trigger: 'axis'
          },
          //工具框，可以选择
          toolbox: {
            feature: {
              saveAsImage: {} //下载工具
            }
          },

          xAxis: {
            name: 'K值',
            type: 'category',
            nameTextStyle: {
              fontSize: 23
            },
            axisLine: {
              lineStyle: {
                // 设置x轴颜色
                color: '#912CEE'
              }
            },
            // 设置X轴数据旋转倾斜
            axisLabel: {
              rotate: 0, // 旋转角度
              interval: 0,  //设置X轴数据间隔几个显示一个，为0表示都显示
              textStyle: {
                fontSize: 23
              }
            },
            // boundaryGap值为false的时候，折线第一个点在y轴上
            boundaryGap: false,
            data: staticnum
          },

          yAxis: {
            name: '数值',
            type: 'value',
            nameTextStyle: {
              fontSize: 23
            },
            min: 0, // 设置y轴刻度的最小值
            max: 1,  // 设置y轴刻度的最大值
            splitNumber: 9,  // 设置y轴刻度间隔个数
            axisLine: {
              lineStyle: {
                // 设置y轴颜色
                color: '#87CEFA'
              }
            },
            axisLabel: {
              textStyle: {
                fontSize: 23
              }
            }
          },

          series: [
            {
              name: '轮廓系数',
              data: kmean_arr[0],
              type: 'line',
              // 设置小圆点消失
              // 注意：设置symbol: 'none'以后，拐点不存在了，设置拐点上显示数值无效
              symbol: 'circle',
              // 设置折线弧度，取值：0-1之间
              smooth: 0.5,
              symbolSize: 10,
              normal: {
                // 拐点上显示数值
                label: {
                  show: true
                }
              },
              borderColor: 'red',  // 拐点边框颜色
              lineStyle: {
                width: 5,  // 设置线宽
                type: 'dotted'  //'dotted'虚线 'solid'实线
              }
            }],
          color: ['#000000']
        };
        myChart.setOption(option);
        document.getElementById("arrow").style.display = "block";
      }

    },
    error: function () {
      html = "<p>" + "网络连接失败,稍后重试" + "</p>";
      window_append(html);
    }
  })

}

//非数字符号 拼接HTML时需要加上转移 \' '\
function showroll(task_name) {

  $('#page-items').html('');
  $.ajax({
    url: "/pipi/search/content_size/" + task_name,
    method: "get",
    dataType: "json",
    success: function (ans) {
      ans = ans / 10 + 1;
      var html_li = "";
      html_li += '<li ><a class="prev" onclick="pageroll(' + (pagerollnum - 1) + ',' + ans + ',' + "\'" + task_name + "\'" + ')">&laquo</a></li>';
      for (var i = 0; i < Math.min(7, ans); i++) {
        html_li += '<li ><a id="li_' + i + '"onclick="pagegoto(' + "\'" + task_name + "\'" + ',' + (i + 1) + ')">' + (i + 1) + '</a></li>';

      }
      html_li += '<li ><a  class="next" onclick="pageroll(' + (pagerollnum + 1) + ',' + ans + ',' + "\'" + task_name + "\'" + ')">&raquo;</a></li>';
      $('#page-items').append(html_li);
      if (document.getElementById(prepage) != null)
        document.getElementById(prepage).className = "active";
    }
  });
}
function pagegoto(task_name, pageid) {

  $.ajax({
    url: "/pipi/search/content/" + task_name + "/" + pageid,
    method: "get",
    dataType: "json",
    success: function (ans) {
      var tr = document.getElementById("sdata");
      for (var i = tr.rows.length - 1; i >= 0; i--) {
        tr.deleteRow(i);
      }

      var html_tr = "";
      for (var i = 0; i < ans.length; i++) {
        html_tr += '<tr><td>' + (i + 1 + (pageid - 1) * 10) + '</td>' +
          '<td>' + (ans[i].length > 60 ? (ans[i].substring(0, 60) + '...') : (ans[i])) + '</td></tr>';
      }

      $('#sdata').append(html_tr);
      if (document.getElementById(prepage) != null)
        document.getElementById(prepage).className = "";
      var url = "li_" + (pageid - 1);
      if (document.getElementById(url) != null)
        document.getElementById(url).className = "active";
      prepage = url;

    }
  });


}
function pageroll(pagerollnum, ans, task_name) {
  if (pagerollnum < 0) pagerollnum = 0;


  $('#page-items').html('');
  var html_li = "";
  html_li += '<li ><a class="prev" onclick="pageroll(' + (pagerollnum - 1) + ',' + ans + ',' + "\'" + task_name + "\'" + ')">&laquo</a></li>';
  for (var i = 7 * pagerollnum; i < Math.min(7 * (pagerollnum + 1), ans); i++) {
    html_li += '<li ><a id="li_' + i + '" onclick="pagegoto(' + "\'" + task_name + "\'" + ',' + (i + 1) + ')">' + (i + 1) + '</a></li>';

  }

  html_li += '<li ><a class="next" onclick="pageroll(' + (pagerollnum + 1) + ',' + ans + ',' + "\'" + task_name + "\'" + ')">&raquo;</a></li>';
  $('#page-items').append(html_li);
  if (document.getElementById(prepage) != null)
    document.getElementById(prepage).className = "active";


}
function choose_task(onlyid) {
  chooseonlyid = onlyid;
  //alert(document.getElementById("sourcedata").style.backgroundColor);
  if (sourcekey == true) {
    pagegoto(onlyid, 1);
    showroll(onlyid);
  } else if (jiebakey == true) {

    pagegoto(onlyid + "_jieba", 1);
    showroll(onlyid + "_jieba");
  }
}
function doplot(onlyid) {
  //用户无任务时
  if (onlyid == -1) return;

  st = new Array();
  var data;

  $.ajax({
    url: "/pipi/plot/" + onlyid,
    type: "get",
    async: true,
    success: function (datapojo) {

      st[0] = String(datapojo.task_res_emotion);
      st[1] = String(datapojo.task_res_len);
      st[2] = String(datapojo.task_res_polar);
      st[3] = String(datapojo.task_res_top);

      var res = new Array();
      for (var i = 0; i < Number(st[0].split(" ").length); i++) {
        res[i] = Number(st[0].split(" ")[i]);
      }
      data = res;
      superman = "";
      superman += superthink_no1(data);
      // 基于准备好的dom，初始化echarts实例
      var myChart = echarts.init(document.getElementById('chart0'));

      // 指定图表的配置项和数据
      var option = {
        title: {
          text: ''
        },
        tooltip: {},
        legend: {

        },
        xAxis: {
          data: ["HAPPY", "GOOD", "SURPRISE", "ANGER", "SAD", "FEAR", "DISGUST"],
          axisLabel: {
            interva: 0,
            rotate: -30
          }
        },
        yAxis: {},
        series: [{
          name: '',
          type: 'bar',
          data: data,
          itemStyle: {
            normal: {
              label: {
                show: true, //开启显示
                position: 'top', //在上方显示
                textStyle: { //数值样式
                  color: 'black',
                  fontSize: 16
                }
              },
              color: function (params) {
                var colorList = [
                  '#FF6666',
                  '#00ff40', 'rgb(255, 128, 192)', '#800000',
                  'rgb(192, 192, 192)', 'black', 'rgb(0, 64, 128)'];
                return colorList[params.dataIndex]
              }
            }
          }
        }]
      };
      // 使用刚指定的配置项和数据显示图表。
      myChart.setOption(option);
      var res = new Array();
      for (var i = 0; i < Number(st[1].split(" ").length); i++) {
        res[i] = Number(st[1].split(" ")[i]);
      }

      data = res;
      superman += superthink_no2(data);
      var myChart = echarts.init(document.getElementById('chart1'));

      myChart.setOption({
        legend: {
          orient: 'vertical',
          x: 'right',      //可设定图例在左、右、居中
          y: 'center',     //可设定图例在上、下、居中
          right: 20,
          top: 10,
          data: ["字数少于25", "字数少于50大于25", "字数大于50"]
        },
        series: [
          {
            name: '评论长度',
            type: 'pie',    // 设置图表类型为饼图
            radius: '55%',  // 饼图的半径，外半径为可视区尺寸（容器高宽中较小一项）的 55% 长度。
            data: [          // 数据数组，name 为数据项名称，value 为数据项值
              { value: data[0], name: '字数少于25' },
              { value: data[1], name: '字数少于50大于25' },
              { value: data[2], name: '字数大于50' },
            ],
            itemStyle: {
              normal: {
                label: {
                  show: true,
                  formatter: '{b}\n : {c} ({d}%)'
                },
                labelLine: { show: true }
              }
            }

          }
        ]
      });

      var res = new Array();
      var res2 = new Array();
      for (var i = 0; i + 1 < Number(st[3].split(" ").length); i += 2) {
        res[i / 2] = Number(st[3].split(" ")[i + 1]);
        res2[i / 2] = st[3].split(" ")[i];
      }
      data = res;
      var myChart = echarts.init(document.getElementById('chart2'));
      // 指定图表的配置项和数据
      var option = {
        title: {
          text: ''
        },
        tooltip: {},
        legend: {

        },
        xAxis: {
          data: res2,
          axisLabel: {
            interva: 0,
            rotate: -30
          }
        },
        yAxis: {},
        series: [{
          name: '',
          type: 'bar',
          data: data,
          itemStyle: {
            normal: {
              label: {
                show: true, //开启显示
                position: 'top', //在上方显示
                textStyle: { //数值样式
                  color: 'black',
                  fontSize: 16
                }
              },
              color: function (params) {
                var colorList = [
                  '#FF6666',
                  '#00ff40', 'rgb(255, 128, 192)', '#800000',
                ];
                return colorList[params.dataIndex]
              }
            }
          }
        }]
      };
      // 使用刚指定的配置项和数据显示图表。
      myChart.setOption(option);
      var res = new Array();
      res = new Array();
      for (var i = 0; i < Number(st[2].split(" ").length); i++) {
        res[i] = Number(st[2].split(" ")[i]);
      }

      data = res;
      superman += superthink_no4(data);
      var myChart = echarts.init(document.getElementById('chart3'));

      myChart.setOption({
        legend: {
          orient: 'vertical',
          x: 'right',      //可设定图例在左、右、居中
          y: 'center',     //可设定图例在上、下、居中
          right: 20,
          top: 10,
          data: ["积极", "中性", "消极"]
        },
        series: [
          {
            name: '情感极性',
            type: 'pie',    // 设置图表类型为饼图
            radius: '55%',  // 饼图的半径，外半径为可视区尺寸（容器高宽中较小一项）的 55% 长度。
            data: [          // 数据数组，name 为数据项名称，value 为数据项值
              { value: data[0], name: '积极' },
              { value: data[1], name: '中性' },
              { value: data[2], name: '消极' },
            ],
            itemStyle: {
              normal: {
                label: {
                  show: true,
                  formatter: '{b} : {c} \n({d}%)'
                },
                labelLine: { show: true }
              }
            }
          }
        ]
      });
    }

  });


}
function doplotpage() {
  $('#emotion_head').html('');

  var url = "/pipi/search/usertask/" + username;
  $.ajax({
    type: "get",
    url: url,
    success: function (dataList) {
      var html_button = '<ul>';
      for (var i = 0; i < dataList.length; i++) {
        if (i == 0) {
          html_button += '<li class="listbutton" style="color: rgb(36, 191, 64);"onclick="changecolor_emo(this);doplot(' + dataList[i].task_id + ')";>' + dataList[i].task_name + '</li>';
        }
        else
          html_button += '<li class="listbutton" onclick="changecolor_emo(this);doplot(' + dataList[i].task_id + ')";>' + dataList[i].task_name + '</li>';
      }
      html_button += '</ul>';
      $('#emotion_head').append(html_button);

    },
    error: function () {
      html = "<p>" + "网络连接失败,稍后重试" + "</p>";
      window_append(html);
    }
  })

}
function cloud() {
  $('#wordcloud_head').html('');



  var url = "/pipi/search/usertask/" + username;
  $.ajax({
    type: "get",
    url: url,
    success: function (dataList) {
      var html_button = '<ul>';
      for (var i = 0; i < dataList.length; i++) {
        if (i == 0) {
          html_button += '<li class="listbutton" style="color: rgb(36, 191, 64);"onclick="changecolor_cloud(this);docloud(' + dataList[i].task_id + ')";>' + dataList[i].task_name + '</li>';
        }
        else
          html_button += '<li class="listbutton" onclick="changecolor_cloud(this);docloud(' + dataList[i].task_id + ')";>' + dataList[i].task_name + '</li>';
      }
      html_button += '</ul>';
      $('#wordcloud_head').append(html_button);

    },
    error: function () {
      html = "<p>" + "网络连接失败,稍后重试" + "</p>";
      window_append(html);
    }
  })

}
//使用html拼接  img 标签没有反应
function docloud(onlyid) {
  if (onlyid == -1) {
    document.getElementById('wordpng').src = '/pipi/getpng/' + 30;
    return;
  }
  document.getElementById('wordpng').src = '/pipi/getpng/' + onlyid;

}


function closetable() {


  isHide = !isHide;
  if (isHide == false) {

    $("#table_head").removeClass("table_close");
    $("#table_head").addClass("table_show");
    $("#table_head").show();
    //console.log("123");
    // setTimeout("show('#table_head')",1000);
    document.getElementById('ctb').innerHTML = '隐藏任务';
    $("#ctb_i").removeClass("fa-eye");
    $("#ctb_i").addClass("fa-eye-slash");
    $("#ctb_i").css("left", "38.5%");
  }
  else {
    $("#table_head").removeClass("table_show");
    $("#table_head").addClass("table_close");
    setTimeout("close('#table_head')", 1000);

    document.getElementById('ctb').innerHTML = '显示任务';
    $("#ctb_i").removeClass("fa-eye-slash");
    $("#ctb_i").addClass("fa-eye");
    $("#ctb_i").css("left", "39.5%");
  }

}
function changecolor_emo(obj) {
  var arr = document.getElementById("emotion_head").getElementsByTagName("li");
  for (var i = 0; i < arr.length; i++) {
    var a = arr[i];
    a.style.color = "black";
  }
  obj.style.color = "rgb(36, 191, 64)"
}
function changecolor_jieba(obj) {
  var arr = document.getElementById("jieba_head").getElementsByTagName("li");
  for (var i = 0; i < arr.length; i++) {
    var a = arr[i];
    a.style.color = "black";
  }
  obj.style.color = "rgb(36, 191, 64)"
}
function changecolor_cloud(obj) {
  var arr = document.getElementById("wordcloud_head").getElementsByTagName("li");
  for (var i = 0; i < arr.length; i++) {
    var a = arr[i];
    a.style.color = "black";
  }
  obj.style.color = "rgb(36, 191, 64)"
}
function changecolor_kmeans(obj) {
  var index = 0;
  var arr = document.getElementById("kmeans_head").getElementsByTagName("li");
  for (var i = 0; i < arr.length; i++) {
    var a = arr[i];
    a.style.color = "black";
  }
  obj.style.color = "rgb(36, 191, 64)";
  for (var i = 0; i < arr.length; i++) {
    var a = arr[i];
    if (a.style.color == "rgb(36, 191, 64)")
      index = i;
  }
  task_onlyid = task_id[index];
  kind = 3;
  var name1 = username + "_" + kind + "_" + task_onlyid + "_" + "0";
  var name2 = username + "_" + kind + "_" + task_onlyid + "_" + "1";
  if (getCookie(name1) == null || getCookie(name2) == null) {
    echarts.init(document.getElementById('k_char0')).clear();
    document.getElementById("arrow").style.display = "none";
    return;
  }
  kmean_arr[0] = getCookie(name1).split(",");
  kmean_arr[1] = getCookie(name2).split(",");

  kmean_index = 0;
  var myChart = echarts.init(document.getElementById('k_char0'));
  var option = {
    //backgroundColor: '#FFF0F5',
    title: {
      text: '轮廓系数得分',
      x: 'center',
      textStyle: {
        fontSize: 25,
        color: '#000000'  //标题颜色
      }
    },
    legend: {
      // orient 设置布局方式，默认水平布局，可选值：'horizontal'（水平） ¦ 'vertical'（垂直）
      orient: 'horizontal',
      // x 设置水平安放位置，默认全图居中，可选值：'center' ¦ 'left' ¦ 'right' ¦ {number}（x坐标，单位px）
      x: 'left',
      // y 设置垂直安放位置，默认全图顶端，可选值：'top' ¦ 'bottom' ¦ 'center' ¦ {number}（y坐标，单位px）
      y: 'top',
      data: ['轮廓系数']
    },
    tooltip: {
      trigger: 'axis'
    },
    //工具框，可以选择
    toolbox: {
      feature: {
        saveAsImage: {} //下载工具
      }
    },

    xAxis: {
      name: 'K值',
      type: 'category',
      nameTextStyle: {
        fontSize: 23
      },
      axisLine: {
        lineStyle: {
          // 设置x轴颜色
          color: '#912CEE'
        }
      },
      // 设置X轴数据旋转倾斜
      axisLabel: {
        rotate: 0, // 旋转角度
        interval: 0,  //设置X轴数据间隔几个显示一个，为0表示都显示
        textStyle: {
          fontSize: 23
        }
      },
      // boundaryGap值为false的时候，折线第一个点在y轴上
      boundaryGap: false,
      data: staticnum
    },

    yAxis: {
      name: '数值',
      type: 'value',
      nameTextStyle: {
        fontSize: 23
      },
      min: 0, // 设置y轴刻度的最小值
      max: 1,  // 设置y轴刻度的最大值
      splitNumber: 9,  // 设置y轴刻度间隔个数
      axisLine: {
        lineStyle: {
          // 设置y轴颜色
          color: '#87CEFA'
        }
      },
      axisLabel: {
        textStyle: {
          fontSize: 23
        }
      }
    },

    series: [
      {
        name: '轮廓系数',
        data: kmean_arr[kmean_index],
        type: 'line',
        // 设置小圆点消失
        // 注意：设置symbol: 'none'以后，拐点不存在了，设置拐点上显示数值无效
        symbol: 'circle',
        // 设置折线弧度，取值：0-1之间
        smooth: 0.5,
        symbolSize: 10,
        normal: {
          // 拐点上显示数值
          label: {
            show: true
          }
        },
        borderColor: 'red',  // 拐点边框颜色
        lineStyle: {
          width: 5,  // 设置线宽
          type: 'dotted'  //'dotted'虚线 'solid'实线
        }
      }],
    color: ['#000000']
  };
  myChart.setOption(option);
  document.getElementById("arrow").style.display = "block";
  document.getElementById("arrowright").className = "arrowright";
}
function go_kmeans() {
  var html = "<p>" + "正在处理" + "</p>";
  window_append(html);
  document.getElementById("h_title").innerHTML = "聚类得分";
  var kind = 3;
  if (document.getElementById("rs_button").className == "kcheck_box_active")
    kind = 0;
  else if (document.getElementById("whiten_button").className == "kcheck_box_active")
    kind = 1;
  else if (document.getElementById("min_button").className == "kcheck_box_active")
    kind = 2;

  var arr = [];
  var num = [];
  $.ajax({

    url: "/pipi/dokmeans/" + kind + "/" + task_onlyid,
    method: "get",
    dataType: "json",
    success: function (list) {
      for (var i = 0; i < list.length; i++) {
        arr[i] = new Array();
        var st = list[i].substring(1, list[i].length - 1).split(",");
        for (var j = 0; j < st.length; j++) {

          arr[i][j] = Number(st[j]);
          num[j] = j + 2;
        }
      }
      staticnum = num;
      kmean_arr[0] = arr[0];
      kmean_arr[1] = arr[1];
      kmean_index = 0;
      // alert(arr);
      var html = "<p>" + "处理成功" + "</p>";
      window_append(html);
      var myChart = echarts.init(document.getElementById('k_char0'));
      var option = {
        //backgroundColor: '#FFF0F5',
        title: {
          text: '轮廓系数得分',
          x: 'center',
          textStyle: {
            fontSize: 25,
            color: '#000000'  //标题颜色
          }
        },
        legend: {
          // orient 设置布局方式，默认水平布局，可选值：'horizontal'（水平） ¦ 'vertical'（垂直）
          orient: 'horizontal',
          // x 设置水平安放位置，默认全图居中，可选值：'center' ¦ 'left' ¦ 'right' ¦ {number}（x坐标，单位px）
          x: 'left',
          // y 设置垂直安放位置，默认全图顶端，可选值：'top' ¦ 'bottom' ¦ 'center' ¦ {number}（y坐标，单位px）
          y: 'top',
          data: ['轮廓系数']
        },

        // 提示框
        tooltip: {
          trigger: 'axis'
        },
        //工具框，可以选择
        toolbox: {
          feature: {
            saveAsImage: {} //下载工具
          }
        },

        xAxis: {
          name: 'K值',
          type: 'category',
          nameTextStyle: {
            fontSize: 23
          },
          axisLine: {
            lineStyle: {
              // 设置x轴颜色
              color: '#912CEE'
            }
          },
          // 设置X轴数据旋转倾斜
          axisLabel: {
            rotate: 0, // 旋转角度
            interval: 0,  //设置X轴数据间隔几个显示一个，为0表示都显示
            textStyle: {
              fontSize: 23
            }
          },
          // boundaryGap值为false的时候，折线第一个点在y轴上
          boundaryGap: false,
          data: num
        },

        yAxis: {
          name: '数值',
          type: 'value',
          nameTextStyle: {
            fontSize: 23
          },
          min: 0, // 设置y轴刻度的最小值
          max: 1,  // 设置y轴刻度的最大值
          splitNumber: 9,  // 设置y轴刻度间隔个数
          axisLine: {
            lineStyle: {
              // 设置y轴颜色
              color: '#87CEFA'
            }
          },
          axisLabel: {
            textStyle: {
              fontSize: 23
            }
          }
        },

        series: [
          {
            name: '轮廓系数',
            data: arr[0],
            type: 'line',
            // 设置小圆点消失
            // 注意：设置symbol: 'none'以后，拐点不存在了，设置拐点上显示数值无效
            symbol: 'circle',
            // 设置折线弧度，取值：0-1之间
            smooth: 0.5,
            symbolSize: 10,
            normal: {
              // 拐点上显示数值
              label: {
                show: true
              }
            },
            borderColor: 'red',  // 拐点边框颜色
            lineStyle: {
              width: 5,  // 设置线宽
              type: 'dotted'  //'dotted'虚线 'solid'实线
            }
          }],
        color: ['#000000']
      };
      myChart.setOption(option);
      document.getElementById("arrow").style.display = "block";
      document.getElementById("arrowright").className = "arrowright";
      var name1 = "0" + "_" + kind + "_" + task_onlyid + "_" + "0";
      var name2 = "0" + "_" + kind + "_" + task_onlyid + "_" + "1";
      setCookie(name1, arr[0], "h24");
      setCookie(name2, arr[1], "h24");
    }
  });
}
function change_task(onlyid) {
  task_onlyid = onlyid;
}
function gotokeans() {
  kmean_index = 1 - kmean_index;

  if (kmean_index == 1) {
    document.getElementById("arrowright").className = "arrowleft";
    var myChart = echarts.init(document.getElementById('k_char0'));
    var option = {
      //backgroundColor: '#FFF0F5',
      title: {
        text: 'inertias系数得分',

        x: 'center',
        textStyle: {
          fontSize: 25,
          color: '#000000'  //标题颜色
        },
      },
      legend: {
        // orient 设置布局方式，默认水平布局，可选值：'horizontal'（水平） ¦ 'vertical'（垂直）
        orient: 'horizontal',
        // x 设置水平安放位置，默认全图居中，可选值：'center' ¦ 'left' ¦ 'right' ¦ {number}（x坐标，单位px）
        x: 'left',
        // y 设置垂直安放位置，默认全图顶端，可选值：'top' ¦ 'bottom' ¦ 'center' ¦ {number}（y坐标，单位px）
        y: 'top',
        data: ['inertias系数']
      },
      // 提示框
      tooltip: {
        trigger: 'axis'
      },
      //工具框，可以选择
      toolbox: {
        feature: {
          saveAsImage: {} //下载工具
        }
      },

      xAxis: {
        name: 'K值',
        type: 'category',
        nameTextStyle: {
          fontSize: 23
        },
        axisLine: {
          lineStyle: {
            // 设置x轴颜色
            color: '#912CEE'
          },

        },
        // 设置X轴数据旋转倾斜
        axisLabel: {
          rotate: 0, // 旋转角度
          interval: 0,  //设置X轴数据间隔几个显示一个，为0表示都显示
          textStyle: {
            fontSize: 23
          }
        },
        // boundaryGap值为false的时候，折线第一个点在y轴上
        boundaryGap: false,
        data: staticnum
      },

      yAxis: {
        name: '数值',
        type: 'value',
        nameTextStyle: {
          fontSize: 23
        },
        min: minbottom(arrmin(kmean_arr[kmean_index])), // 设置y轴刻度的最小值
        max: maxtop(arrmax(kmean_arr[kmean_index])),  // 设置y轴刻度的最大值
        splitNumber: 9,  // 设置y轴刻度间隔个数

        axisLine: {
          lineStyle: {
            // 设置y轴颜色
            color: '#87CEFA'
          },
        },
        axisLabel: {
          textStyle: {
            fontSize: 23
          }
        }
      },

      series: [
        {
          name: 'inertias系数',
          data: kmean_arr[kmean_index],
          type: 'line',
          // 设置小圆点消失
          // 注意：设置symbol: 'none'以后，拐点不存在了，设置拐点上显示数值无效
          symbol: 'circle',
          // 设置折线弧度，取值：0-1之间
          smooth: 0.5,
          symbolSize: 10,
          normal: {
            // 拐点上显示数值
            label: {
              show: true
            }
          },
          borderColor: 'red',  // 拐点边框颜色
          lineStyle: {
            width: 5,  // 设置线宽
            type: 'dotted'  //'dotted'虚线 'solid'实线
          }
        }],
      color: ['#000000']
    };
    myChart.setOption(option);
  }
  else if (kmean_index == 0) {
    document.getElementById("arrowright").className = "arrowright";
    var myChart = echarts.init(document.getElementById('k_char0'));
    var option = {
      //backgroundColor: '#FFF0F5',
      title: {
        text: '轮廓系数得分',
        x: 'center',
        textStyle: {
          fontSize: 25,
          color: '#000000'  //标题颜色
        }
      },
      legend: {
        // orient 设置布局方式，默认水平布局，可选值：'horizontal'（水平） ¦ 'vertical'（垂直）
        orient: 'horizontal',
        // x 设置水平安放位置，默认全图居中，可选值：'center' ¦ 'left' ¦ 'right' ¦ {number}（x坐标，单位px）
        x: 'left',
        // y 设置垂直安放位置，默认全图顶端，可选值：'top' ¦ 'bottom' ¦ 'center' ¦ {number}（y坐标，单位px）
        y: 'top',
        data: ['轮廓系数']
      },
      tooltip: {
        trigger: 'axis'
      },
      //工具框，可以选择
      toolbox: {
        feature: {
          saveAsImage: {} //下载工具
        }
      },

      xAxis: {
        name: 'K值',
        type: 'category',
        nameTextStyle: {
          fontSize: 23
        },
        axisLine: {
          lineStyle: {
            // 设置x轴颜色
            color: '#912CEE'
          }
        },
        // 设置X轴数据旋转倾斜
        axisLabel: {
          rotate: 0, // 旋转角度
          interval: 0,  //设置X轴数据间隔几个显示一个，为0表示都显示
          textStyle: {
            fontSize: 23
          }
        },
        // boundaryGap值为false的时候，折线第一个点在y轴上
        boundaryGap: false,
        data: staticnum
      },

      yAxis: {
        name: '数值',
        type: 'value',
        nameTextStyle: {
          fontSize: 23
        },
        min: 0, // 设置y轴刻度的最小值
        max: 1,  // 设置y轴刻度的最大值
        splitNumber: 9,  // 设置y轴刻度间隔个数
        axisLine: {
          lineStyle: {
            // 设置y轴颜色
            color: '#87CEFA'
          }
        },
        axisLabel: {
          textStyle: {
            fontSize: 23
          }
        }
      },

      series: [
        {
          name: '轮廓系数',
          data: kmean_arr[kmean_index],
          type: 'line',
          // 设置小圆点消失
          // 注意：设置symbol: 'none'以后，拐点不存在了，设置拐点上显示数值无效
          symbol: 'circle',
          // 设置折线弧度，取值：0-1之间
          smooth: 0.5,
          symbolSize: 10,
          normal: {
            // 拐点上显示数值
            label: {
              show: true
            }
          },
          borderColor: 'red',  // 拐点边框颜色
          lineStyle: {
            width: 5,  // 设置线宽
            type: 'dotted'  //'dotted'虚线 'solid'实线
          }
        }],
      color: ['#000000']
    };
    myChart.setOption(option);
  }
}
function arrmin(arr) {
  var min = Number(arr[0]);

  for (var i = 1; i < arr.length; i++)
    if (min > Number(arr[i])) min = arr[i];
  return min;
}
function arrmax(arr) {
  var max = Number(arr[0]);
  for (var i = 1; i < arr.length; i++)
    if (max < Number(arr[i])) max = arr[i];

  return max;
}
function minbottom(min) {

  return Math.floor(Number(min));
}
function maxtop(max) {
  return max;
}
function setCookie(name, value, time) {
  var strsec = getsec(time);
  var exp = new Date();
  exp.setTime(exp.getTime() + strsec * 1);
  document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString();
}
function delCookie(name) {
  var exp = new Date();
  exp.setTime(exp.getTime() - 1);
  var cval = getCookie(name);
  if (cval != null)
    document.cookie = name + "=" + cval + ";expires=" + exp.toGMTString();
}
function getCookie(name) {
  var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");

  if (arr = document.cookie.match(reg))

    return unescape(arr[2]);
  else
    return null;
}
function getsec(str) {
  var str1 = str.substring(1, str.length);
  var str2 = str.substring(0, 1);
  if (str2 == "s") {
    return str1 * 1000;
  }
  else if (str2 == "h") {
    return str1 * 60 * 60 * 1000;
  }
  else if (str2 == "d") {
    return str1 * 24 * 60 * 60 * 1000;
  }
}
//这是有设定过期时间的使用示例：
//s20是代表20秒
//h是指小时，如12小时则是：h12
//d是天数，30天则：d30


function kmeans(buttonid) {
  kind = 3;
  document.getElementById("rs_button").className = "kcheck_box";
  document.getElementById("whiten_button").className = "kcheck_box";
  document.getElementById("min_button").className = "kcheck_box";
  document.getElementById("none_button").className = "kcheck_box";
  document.getElementById(buttonid).className = "kcheck_box_active";
  if (buttonid == "rs_button") {
    kind = 0;
  }
  else if (buttonid == "whiten_button") {
    kind = 1;
  }
  else if (buttonid == "min_button") {
    kind = 2;
  }
  else if (buttonid == "none_button") {
    kind = 3;
  }
  var name1 = username + "_" + kind + "_" + task_onlyid + "_" + "0";
  var name2 = username + "_" + kind + "_" + task_onlyid + "_" + "1";
  if (getCookie(name1) != null && getCookie(name2) != null) {
    kmean_arr[0] = getCookie(name1).split(",");
    kmean_arr[1] = getCookie(name2).split(",");
    kmean_index = 0;
    // alert(arr);
    var myChart = echarts.init(document.getElementById('k_char0'));
    var option = {
      //backgroundColor: '#FFF0F5',
      title: {
        text: '轮廓系数得分',
        x: 'center',
        textStyle: {
          fontSize: 25,
          color: '#000000'  //标题颜色
        }
      },
      legend: {
        // orient 设置布局方式，默认水平布局，可选值：'horizontal'（水平） ¦ 'vertical'（垂直）
        orient: 'horizontal',
        // x 设置水平安放位置，默认全图居中，可选值：'center' ¦ 'left' ¦ 'right' ¦ {number}（x坐标，单位px）
        x: 'left',
        // y 设置垂直安放位置，默认全图顶端，可选值：'top' ¦ 'bottom' ¦ 'center' ¦ {number}（y坐标，单位px）
        y: 'top',
        data: ['轮廓系数']
      },

      // 提示框
      tooltip: {
        trigger: 'axis'
      },
      //工具框，可以选择
      toolbox: {
        feature: {
          saveAsImage: {} //下载工具
        }
      },

      xAxis: {
        name: 'K值',
        type: 'category',
        nameTextStyle: {
          fontSize: 23
        },
        axisLine: {
          lineStyle: {
            // 设置x轴颜色
            color: '#912CEE'
          }
        },
        // 设置X轴数据旋转倾斜
        axisLabel: {
          rotate: 0, // 旋转角度
          interval: 0,  //设置X轴数据间隔几个显示一个，为0表示都显示
          textStyle: {
            fontSize: 23
          }
        },
        // boundaryGap值为false的时候，折线第一个点在y轴上
        boundaryGap: false,
        data: staticnum
      },

      yAxis: {
        name: '数值',
        type: 'value',
        nameTextStyle: {
          fontSize: 23
        },
        min: 0, // 设置y轴刻度的最小值
        max: 1,  // 设置y轴刻度的最大值
        splitNumber: 9,  // 设置y轴刻度间隔个数
        axisLine: {
          lineStyle: {
            // 设置y轴颜色
            color: '#87CEFA'
          }
        },
        axisLabel: {
          textStyle: {
            fontSize: 23
          }
        }
      },

      series: [
        {
          name: '轮廓系数',
          data: kmean_arr[0],
          type: 'line',
          // 设置小圆点消失
          // 注意：设置symbol: 'none'以后，拐点不存在了，设置拐点上显示数值无效
          symbol: 'circle',
          // 设置折线弧度，取值：0-1之间
          smooth: 0.5,
          symbolSize: 10,
          normal: {
            // 拐点上显示数值
            label: {
              show: true
            }
          },
          borderColor: 'red',  // 拐点边框颜色
          lineStyle: {
            width: 5,  // 设置线宽
            type: 'dotted'  //'dotted'虚线 'solid'实线
          }
        }],
      color: ['#000000']
    };
    myChart.setOption(option);
    document.getElementById("arrow").style.display = "block";
    document.getElementById("arrowright").className = "arrowright";
  } else {
    var myChart = echarts.init(document.getElementById('k_char0')).clear();
    document.getElementById("arrow").style.display = "none";
  }
}
function do_kmeans() {
  var html = "<p>" + "正在处理" + "</p>";
  window_append(html);
  var v = document.getElementById("k_value");
  var value = v.options[v.selectedIndex].innerHTML;
  //alert(v.options[v.selectedIndex].innerHTML+" "+task_onlyid);
  v.value = "主题聚类";
  var url = "/pipi/kmeans/" + task_onlyid + "/" + value;
  $.ajax({
    type: "get",
    url: url,
    success: function (data) {
      document.getElementById("h_title").innerHTML = "主题聚类";
      //之后用echarts进行饼图的展示
      var html = "<p>" + "处理成功" + "</p>";
      window_append(html);
      echarts_pie(data);
    },
    error: function () {

    }
  })
}
var menu_key = false;
//var time=0;
function menu_hide() {
  //alert(menu_key+" "+time);
  if (menu_key == false) {
    $("#menu").removeClass("menu_open").addClass("menu_close");
    // $("#ctb_div").removeClass("ctb_open").addClass("ctb_close");
    $("#content").removeClass("content_open").addClass("content_close");
    $("#title_div").hide();
    $("#menu_content").hide();
    $("#title_span").removeAttr("onclick");
    //这里出现一次递归 原因是来源同一个div 没法直接用延迟
    setTimeout('$("#menu").attr("onclick","menu_hide()");', 1000);
    menu_key = true;
  }
  else if (menu_key == true) {

    $("#menu").removeClass("menu_close").addClass("menu_open");
    // $("#ctb_div").removeClass("ctb_close").addClass("ctb_open");
    $("#content").removeClass("content_close").addClass("content_open");
    $("#menu").removeAttr("onclick");
    //同上理
    setTimeout('$("#title_span").attr("onclick","menu_hide()");', 1000);
    // $("#title_span").attr("onclick","menu_hide()");
    menu_key = false;
    setTimeout("show_all()", 1000);//延时1.5秒

  }

}
$(function () {
  //不延迟直接蹦出来就麻烦了
  setTimeout("show_all()", 1000);//延时1.5秒

})
function show_all() {
  $("#title_div").show();
  $("#menu_content").show();
}
function echarts_pie(data) {
  var list = [];
  var value = [];

  for (var i = 0; i < data.length; i++) {
    var st = data[i].split(" ");
    var str = "主题" + (i + 1) + ":";
    for (var j = 0; j < st.length - 1; j++)str += st[j];
    list[i] = str;
    value[i] = Number(st[st.length - 1]);
  }
  var piedata = [];
  for (var i = 0; i < data.length; i++)
    piedata.push({
      value: value[i],
      name: list[i]
    })

  $("#arrow").hide();

  var myChart = echarts.init(document.getElementById('k_char0'));
  myChart.clear();
  myChart.setOption({
    legend: {
      orient: 'vertical',
      x: 'right',      //可设定图例在左、右、居中
      y: 'center',     //可设定图例在上、下、居中
      right: 20,
      top: 10,
      data: list
    },
    series: [
      {
        name: '主题分类',
        type: 'pie',    // 设置图表类型为饼图
        radius: '55%',  // 饼图的半径，外半径为可视区尺寸（容器高宽中较小一项）的 55% 长度。
        data: piedata,
        itemStyle: {
          normal: {
            label: {
              show: true,
              formatter: '{b}\n : {c} ({d}%)'
            },
            labelLine: { show: true }
          }
        }

      }
    ]
  });

  $("#k_char0").show();
}
function window_append(html) {
  $("#tip_close_content").empty();
  $("#tip_window").show();
  $("#tip_close_content").append(html);
}
function close(val) {
  $(val).hide();
}
function show(val) {
  $(val).show();
}
function objremove(obj, cl) {
  $(obj).removeClass(cl);
}
function close_win() {
  $("#subwindow").removeClass("subwin_close");
  $("#subwindow").addClass("subwin_show");
}
function backlogin(obj) {
  html = "<p>" + obj + "</p>";
  window_append(html);
  setTimeout(() => {
    $("#tip_close_button").click();
  }, 1000)
  setTimeout(() => {
    window.location.href = "http://localhost:8080/pipi/login";
  }, 2100)
}
function superthink_no1(data) {
  var res = "";
  var max = data[0];
  var index = 0;
  var add = 0;

  for (var i = 0; i < data.length; i++) {
    add += data[i];
    if (max < data[i]) { max = data[i]; index = i; }
  }
  var kind = ["喜悦", "赞美", "惊喜", "愤怒", "伤心", "恐惧", "疑惑"];
  res = "<p>" + ((max / add).toFixed(2) * 100) + "%的评论表现了" + kind[index] + "的情绪</p>";
  return res;

}
function superthink_no2(data) {
  var res = "";
  var max = data[0];
  max = Math.max(data[1], max);
  max = Math.max(data[2], max);
  if (max == data[0]) {
    res = "<p>" + "整体上短评论为主。" + "</p>"
  } else if (max == data[1]) {
    res = "<p>" + "整体上中等长度评论为主。" + "</p>"
  }
  else if (max == data[2]) {
    res = "<p>" + "整体上长评论为主。" + "</p>"
  }
  return res;
}
function superthink_no4(data) {
  var res = "";
  var count = ((data[0] - data[2]) / data[1]).toFixed(2);

  if (count < -1) res = "<p>比较消极，等分为" + count + "。</p>";
  else if (count < -0.3) res = "<p>偏向消极，等分为" + count + "。</p>";
  else if (count < 0.3) res = "<p>偏向中性，等分为" + count + "。</p>";
  else if (count < 1) res = "<p>偏向积极，等分为" + count + "。</p>";
  else res = "<p>比较积极，等分为" + count + "。</p>";
  return res;
}
function help_superman() {
  var html = "<p>" + superman + "</p>";
  $("#tip_close_content").empty();
  window_append(html);

}
function baby_pen() {
  var html = "<p>意见反馈</p>";
  var input = "<input type='text' autocomplete='off' placeholder=' ' />"
  $("#tip_close_content").empty();
  window_append(html + input);
  $("#tip_close_button").click(function () {
    callyou()
  }
  )

}
function callyou() {

  $("#tip_close_button").unbind("callyou()");
  var formData = new FormData();
  var word = $("#tip_close_content input").val();
  if (word.length == 0) return;
  formData.append("opinion", word);
  $.ajax({
    url: "/pipiandpop/opinion",
    type: "post",
    data: formData,
    processData: false,
    contentType: false,
    success: function (res) {
      if (res) {
        html = "<p>" + "反馈成功！" + "</p>";
        setTimeout(function () {
          window_append(html);
        }, 1100);

      }
    }

  })

}